Skip to content

Conversation

@jycor
Copy link
Contributor

@jycor jycor commented Aug 19, 2025

Golang does not automatically arrange the fields of a struct to reduce memory usage.
I used fieldalignment to rearrange the member variables of all the structs in GMS so they are more compact. The result should be a lower memory footprint and slightly better performance.

I avoided making changes to the test files as they do not impact our performance.

TODO:

  • field align spatial types package
  • field align collations

@jycor jycor force-pushed the james/align branch 4 times, most recently from 5c73097 to 5074e26 Compare August 25, 2025 22:32
Copy link
Contributor

@fulghum fulghum left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes look good. Several comments are getting dropped that seem worth keeping though.

Comment on lines 324 to 332
// reference expression for boundary calculation
orderBy sql.Expression

// boundary arithmetic on [orderBy] for range start value
// is set unless [unboundedPreceding] is true
startInclusion sql.Expression
// boundary arithmetic on [orderBy] for range end value
// is set unless [unboundedFollowing] is true
endInclusion sql.Expression
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not keep these comments around? Seems like they could be helpful for new readers of this code.

Comment on lines 156 to 159
// IsPointLookup is true if the lookup will return one or zero
// values; the range is null safe, the index is unique, every index
// column has a range expression, and every range expression is an
// exact equality.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not keep this comment?


// JsonTableCol represents a column in a json table.
type JsonTableCol struct {
Path string // if there are nested columns, this is a schema Path, otherwise it is a col Path
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This comment seems like it explains non obvious context

Comment on lines 118 to 119
// EventScheduler is used to notify EventSchedulerStatus of database deletion,
// so the events of this database in the scheduler will be removed.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not keep this comment? Doesn't cost anything and may help future maintainers understand the intent of the code faster.


name string
TextDefinition string
// OuterScopeVisibility is true when a SubqueryAlias (i.e. derived table) is contained in a subquery
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like you cut out the first line of this comment, but left in the second line. Please keep this comment in to help future maintainers!

UnaryNode
checks sql.CheckConstraints
Ignore bool
// supported in MySQL's syntax, but is exposed through PostgreSQL's syntax.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This comment also got screwed up. Please fix

@jycor jycor merged commit 53ac7a8 into main Aug 28, 2025
8 checks passed
@jycor jycor deleted the james/align branch August 28, 2025 01:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants